import { history, useLocation } from 'umi';
import { Result, Button } from 'antd';

const Page: React.FC = () => {
  const { state } = useLocation();
  const pageState = state as API.Result;

  return (
    <Result
      status="404"
      title={pageState.errorCode ?? '404'}
      style={{
        background: 'none',
      }}
      subTitle={
        pageState.errorMessage ?? 'Sorry, the page you visited does not exist.'
      }
      extra={
        <Button
          type="primary"
          onClick={() => {
            history.go(-2);
          }}
        >
          返回上一页
        </Button>
      }
    />
  );
};
export default Page;
